#!/bin/bash
#
# Volodymyr P Sergiievskyi, voov.rat@gmail.com
#
#  moldb_getValue Project Chain MethodID Parameters file
#
# return the value from the given file from the database OR NaN (if there are no such file/it is empty)
#
#

Project=$1
Chain=$2
MethodID=$3
Parameters=$4
file=$5

Ref=$(moldb_getRef -p $Project $Chain $MethodID  $Parameters)
NRec=$(echo $Ref | wc -w)

if [ $NRec -gt 1 ]; then
	echo Multiple records match to you criteria.
	exit
fi

if [ -f $Ref/$file ]; then
	Val=$(cat $Ref/$file)
else
	Val=''
fi

[ -z "$Val" ]&& Val=NaN;

echo $Val


	


